// let users = require('../data/userList');

module.exports = {
    'post /login': (ctx, next) => {
        let username = ctx.request.body.username || ''
        let password = ctx.request.body.password || ''
        let list = users.filter(item => {
            return item.username === username && item.password === password;
        })
        let res;
        if (list.length > 0) {
            ctx.body = {
                code: 1000,
                data: list[0],
                msg: '登录成功'
            };
        } else {
            ctx.body = {
                code: 400,
                data: '',
                msg: '用户名或密码错误，请确认后重试'
            };
        }
    }
}